import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:whale/helper/component/page_window/page_window.dart';
import 'package:whale/pages/home/subs/page_window_demo/widgets/tab_container_page.dart';

import 'index.dart';
import 'widgets/widgets.dart';

class PageWindowDemoPage extends GetView<PageWindowDemoController> {
  const PageWindowDemoPage({Key? key}) : super(key: key);

  // 主视图
  Widget _buildView() {
    return TabContainerPage();
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<PageWindowDemoController>(
      builder: (_) {
        return PageWindowContainer(
          page: Scaffold(
            appBar: AppBar(title: const Text("页面内小窗口，随页面消失消失")),
            body: SafeArea(
              child: _buildView(),
            ),
          ),
          windows: [
            PageWindowModel(
                offset: Offset(10, 20),
                child: Container(
                  width: 80,
                  height: 80,
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(40)),
                  child: Icon(
                    Icons.email,
                    size: 30,
                  ),
                )),
          ],
        );
      },
    );
  }
}
